package demo.day08.work_Bank;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/26-07-26-20:14
 * @Description：demo.day08.work_Bank
 */
public class Duration {
    int hours;
    int minutes;
    int seconds;

    public Duration(int hours, int minutes, int seconds) {
        this.hours = hours;
        this.minutes = minutes;
        this.seconds = seconds;
    }

    public int getHours() {
        return hours;
    }

    public int getMinutes() {
        return minutes;
    }

    public int getSeconds() {
        return seconds;
    }

    public Duration(int seconds) {
        this.hours = seconds / 3600;
        this.minutes = seconds % 3600 /60;
        this.seconds = seconds % 60;
    }

    public int totalSeconds(){
        return hours*3600 + minutes*60 + seconds;
    }
    @Override
    public String toString() {
        return "Duration{" +
                "hours=" + hours +
                ", minutes=" + minutes +
                ", seconds=" + seconds +
                '}';
    }
}
